package com.test2015.Swing.render;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.DefaultCellEditor;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.JTextField;

public class MyTableEditor extends DefaultCellEditor {// implements  ItemListener
	private Component comp;

	public MyTableEditor() {
		super(new JCheckBox());
	}

	@Override
	public Component getTableCellEditorComponent(JTable table, Object value,
			boolean isSelected, int row, int column) {

		if(value instanceof JCheckBox){
			comp = (Component)value;
			return (Component)value;
		}
		return comp = new JLabel(value.toString());
	}

	@Override
	public Object getCellEditorValue() {
		return comp;
	}

}
